package com.qqtech.qquan.user.dao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.qqtech.core.frame.dao.BaseDaoImpl;
import com.qqtech.qquan.user.enums.UserIdentityTypeDictEnum;
import com.qqtech.qquan.user.model.UserIdentity;
import com.qqtech.qquan.user.model.UserIdentityVo;

@Repository
public class UserIdentityDaoImpl extends BaseDaoImpl<UserIdentity>implements UserIdentityDao {
	public static final Logger log = LoggerFactory.getLogger(UserIdentityDaoImpl.class);

	@Override
	public UserIdentityVo getIdentityByType(String identity, UserIdentityTypeDictEnum identityType) {
		UserIdentity userIdentity = new UserIdentity();
		userIdentity.setIdentity(identity);
		userIdentity.setType(identityType.getCode());
		return sqlSessionTemplate.selectOne(getSqlName("selectIdentityByType"), userIdentity);
	}

	@Override
	public UserIdentityVo getPhoneIdentity(String identity) {
		return getIdentityByType(identity, UserIdentityTypeDictEnum.PHONE);
	}

}
